{% extends "accounts/summary.htm" %}

{% load accounts_tags %}

{% block title %}{{ block.super }} - Ledger{% endblock %}
{% block breadcrumbs %}
	{{ block.super }}
	<li><a href="{% url ledger account.pk %}">Ledger</a></li>
{% endblock %}
{% block content %}
<table class="full">
	<div style="background: #EEE;">
	{% with account.graph as pix %}
	<img src="{{ pix }}" />
	<pre>{{ pix }}</pre>
	{% endwith %}

	<caption>Actions for {{ account.name }}</caption>
	{% if page.has_other_pages %}
	<thead>
	<tr>
		<th colspan="100%">
			<a href="?page=1">&lt;&lt; Start</a> |
		{% if page.has_previous %}
			<a href="?page={{ page.previous_page_number }}">&lt; Prev</a> |
		{% endif %}
		{{ page }}
		{% if page.has_next %}
			| <a href="?page={{ page.next_page_number }}">Next &gt;</a>
		{% endif %}
			| <a href="?page={{ pages.num_pages }}">End &gt;&gt;</a>
		</th>
	</tr>
	</thead>
	{% endif %} 
	{% for action in page.object_list %}
	<tr class="{% cycle 'even' 'odd' %}">
		<td>{{ action.entry.date|date:"d-M-y" }}</td>
		<td class="right">{{ action.amount|floatformat:2 }}</td>
		<td>{{ action.entry.description }}</td>
	</tr>
	{% endfor %}
</table>
<a href="{% url accounts-close account.id %}">Close this account (not delete, just zero)</a>
{% endblock %}
